﻿using System;
using System.Collections.Generic;
using System.Text;
using Pahan.McuFusion.Common;

namespace Pahan.McuFusion.FusionBoot
{
    [Serializable]
    public class FusionBootAdapterInfo : HardwareAdapterInfo
    {
        #region Overrides of BaseInfo

        public override string Name
        {
            get
            {
                return "FusionBoot Adapter";
            }
        }

        public override string Description
        {
            get
            {
                return "Default adapter for FusionBoot interface.";
            }
        }

        #endregion

        #region Overrides of HardwareAdapterInfo

        /// <summary>
        /// Checks whethes the specified hardware interface is supported by the adapter.
        /// </summary>
        public override bool Supports(HardwareInterfaceInfo hardwareInterface)
        {
            return hardwareInterface.Implements<IFusionBootInterface>();
        }

        /// <summary>
        /// Creates an instance of the adapter.
        /// </summary>
        public override IHardwareAdapter CreateAdapter(IHardwareInterface hardwareInterface)
        {
            Assert.NotNull(hardwareInterface, "hardwareInterface");
            Assert.OfType<IFusionBootInterface>(hardwareInterface, "hardwareInterface");
            return new FusionBootAdapter((IFusionBootInterface)hardwareInterface, this);
        }

        /// <summary>
        /// Gets the list of the interfaces implemented by the realization
        /// of the IHardwareAdapter.
        /// </summary>
        protected override IList<Type> ImplementedInterfaces
        {
            get { return new[] {typeof(IFusionBootAdapter)}; }
        }

        #endregion
    }
}
